#!/usr/bin/env python3
"""
GIF Background Remover - Modern Edition
A modern, flat-design GUI tool for removing backgrounds from GIF animations.
"""

from setuptools import setup, find_packages
import sys
import os

# Read the contents of README file
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f:
    long_description = f.read()

# Read requirements from requirements.txt
def read_requirements():
    requirements = []
    try:
        with open('requirements.txt', 'r', encoding='utf-8') as f:
            for line in f:
                line = line.strip()
                # Skip comments and empty lines
                if line and not line.startswith('#'):
                    # Only keep the package name and version
                    if '>=' in line:
                        requirements.append(line)
    except FileNotFoundError:
        # Fallback to minimal requirements
        requirements = [
            'Pillow>=9.0.0',
            'numpy>=1.21.0',
        ]
    return requirements

# Define console script entry points
console_scripts = [
    'gif-bg-remover=bg:main',
    'gif-background-remover=bg:main',
    'gifbg=bg:main',
]

setup(
    # Basic package information
    name='gif-background-remover-modern',
    version='2.0.0',
    author='GIF Background Remover Team',
    author_email='your-email@example.com',
    description='🎬 Modern flat-design GUI tool for removing backgrounds from GIF animations',
    long_description=long_description,
    long_description_content_type='text/markdown',

    # URLs
    url='https://github.com/your-username/gif-background-remover',
    project_urls={
        'Bug Reports': 'https://github.com/your-username/gif-background-remover/issues',
        'Source': 'https://github.com/your-username/gif-background-remover',
        'Documentation': 'https://github.com/your-username/gif-background-remover/wiki',
    },

    # Package configuration
    py_modules=['bg'],  # Single module file
    packages=find_packages(),

    # Requirements
    python_requires='>=3.8',
    install_requires=[
        'Pillow>=9.0.0',
        'numpy>=1.21.0',
    ],

    # Optional requirements
    extras_require={
        'full': read_requirements(),
        'dev': [
            'pytest>=7.0.0',
            'flake8>=4.0.0',
            'mypy>=0.910',
            'black>=22.0.0',
            'isort>=5.10.0',
        ],
        'build': [
            'pyinstaller>=5.0.0',
            'cx-freeze>=6.0',
            'auto-py-to-exe>=2.20.0',
        ],
        'docs': [
            'sphinx>=4.0.0',
            'sphinx-rtd-theme>=1.0.0',
            'myst-parser>=0.17.0',
        ],
        'scientific': [
            'scipy>=1.8.0',
            'scikit-image>=0.19.0',
            'opencv-python>=4.5.0',
        ],
    },

    # Console scripts
    entry_points={
        'console_scripts': console_scripts,
    },

    # Package data
    include_package_data=True,
    package_data={
        '': ['README.md', 'LICENSE', 'requirements.txt'],
    },

    # PyPI classifiers
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: End Users/Desktop',
        'Intended Audience :: Developers',
        'Topic :: Multimedia :: Graphics :: Graphics Conversion',
        'Topic :: Multimedia :: Graphics :: Editors',
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.8',
        'Programming Language :: Python :: 3.9',
        'Programming Language :: Python :: 3.10',
        'Programming Language :: Python :: 3.11',
        'Programming Language :: Python :: 3.12',
        'Operating System :: OS Independent',
        'Environment :: X11 Applications :: GTK',
        'Environment :: Win32 (MS Windows)',
        'Environment :: MacOS X',
        'Natural Language :: English',
        'Natural Language :: Chinese (Simplified)',
    ],

    # Keywords for discovery
    keywords=[
        'gif', 'background', 'removal', 'transparent', 'animation',
        'image-processing', 'gui', 'tkinter', 'modern-design',
        'flat-ui', 'batch-processing', 'emoji', 'graphics'
    ],

    # Zip safe
    zip_safe=False,

    # Platform
    platforms=['any'],
)